﻿import QtQuick 2.0
import QtGraphicalEffects 1.12
import QtQuick.Controls 2.12
import "../components"
Rectangle {


    id: root

    property real buttonSize: 50*dp
    property bool isHovered: false


    signal clicked()

    height: buttonSize
    width: buttonSize

    radius: buttonSize * 0.5

    color: isHovered ? "#1677FF" : "#FFF"

    property string icon: "qrc:/picture/back.png"
    property string icon_hover: icon


    CustomImage{
        height: buttonSize * 0.5
        width: buttonSize * 0.5
        anchors.centerIn: parent
        source: isHovered ? icon_hover : icon
        z: 1
    }

    MouseArea{
        anchors.fill: parent
        hoverEnabled: true
        cursorShape: Qt.PointingHandCursor
        onEntered: {
            root.isHovered = true
        }onExited: {
            root.isHovered = false
        }
        onClicked: {
            root.clicked()
        }
        z: 1
    }
    layer.enabled: true
    layer.effect: DropShadow{
        color: Qt.rgba(0, 0, 0, 0.1)
        samples: 32
        radius: 12*dp
        spread: 0.1
    }



}
